package com.neusoft.nep.admin.controller;

import com.neusoft.nep.admin.entity.AqiData;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;



    public  class AQIAdminStepViewController {

        @FXML private Label idLabel;
        @FXML private Label locationLabel;
        @FXML private Label levelLabel;
        @FXML private Label datetimeLabel;
        @FXML private Label gridStaffLabel;
        @FXML private Label reporterLabel;
        @FXML private Label descLabel;
        @FXML private Button backBtn;

        private Stage dialog;

        /** 设置详情数据并更新界面 */
        public void setData(AqiData data) {
            idLabel.setText("确认AQI数据编号：" + data.getId());
            locationLabel.setText("确认信息所在地址：" + data.getProvince() + " " + data.getCity());
            levelLabel.setText("确认AQI等级：" + data.getLevel());
            datetimeLabel.setText("确认日期时间：" + data.getDate() + " " + data.getTime());
            gridStaffLabel.setText("网格员信息：" + data.getGridStaff());
            reporterLabel.setText("公众监督员信息：" + data.getReporter());

            // 设置反馈描述（示例数据）
            String[] descriptions = {
                    "该区域空气质量明显下降，建议加强监测",
                    "工业区附近异味明显，怀疑存在违规排放",
                    "交通高峰期尾气污染严重，建议优化交通",
                    "建筑工地扬尘未达标，需加强降尘措施",
                    "监测数据显示臭氧浓度超标，注意防护"
            };
            int index = Integer.parseInt(data.getId()) % descriptions.length;
            descLabel.setText("公众监督员反馈信息描述：" + descriptions[index]);
        }

        /** 设置对话框引用（可选） */
        public void setDialog(Stage dialog) {
            this.dialog = dialog;
        }

        /** 初始化返回按钮事件 */
        @FXML
        private void initialize() {
            backBtn.setOnAction(event -> {
                Stage stage = (Stage) backBtn.getScene().getWindow();
                stage.close();
            });
        }
    }
